package com.qf.dao;

import com.qf.pojo.User;
import com.qf.utils.DBUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class UserDaoImpl implements UserDao {
    private QueryRunner runner = new QueryRunner(DBUtil.getDateSource());
    @Override
    public User selectUser(String uname, String pwd) {
        String sql = "select * from user where username=? and password = ?";
        try {
            return runner.query(sql,new BeanHandler<>(User.class),uname,pwd);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}


